package com.kehongborui.fliggy.controller;

import com.kehongborui.fliggy.model.ResultModel;
import com.kehongborui.fliggy.service.VehicleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zhang peng yang ming
 * @CopyRight (C) http://www.csdn.com
 * @brief
 * @email 122162005@qq.com
 * @date 2018-08-29
 */
@Controller
@RequestMapping("/train")
public class VehicleController {
    @Autowired
    private VehicleService vehicleService;

    @GetMapping
    public String home() {
        return "train/home";
    }

    @GetMapping("/seat")
    @ResponseBody
    public ResultModel getSeatsAmount(String vehicleNo) {
        return ResultModel.OK(vehicleService.getSeatsAmount(vehicleNo));
    }
}
